package com.mario.nanjing.ai.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MarioZzz
 * @create 2025-07-30 15:46
 */
@RestController
public class L4jHelloController {
    @Resource(name = "chatModelQwen")
    private ChatModel chatModelQwen;

    @Resource(name = "chatModelDeepSeek")
    private ChatModel chatModelDeepSeek;
    @PostMapping(value = "/langchain4j/hello")
    public String hello(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        String result = chatModelQwen.chat(question);

        System.out.println("调用qwen大模型回复: " + result);

        return result;
    }

    @PostMapping(value = "/langchain4j/helloDeepSeek")
    public String helloDeepSeek(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        String result = chatModelDeepSeek.chat(question);

        System.out.println("调用DeepSeek大模型回复: " + result);

        return result;
    }
}
